import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:caose/export/caose_widget.dart';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:rebase_project/src/base/widget/AppMapBar.dart';
import 'package:rebase_project/src/base/widget/Button.dart';
import 'package:caose/caose.dart' show NavigatorActionMixin2;

class MmpItem extends Item<String> with NavigatorActionMixin2 {
  @override
  // TODO: implement crossCount
  int get crossCount => 1;

  @override
  // TODO: implement mainPixel
  double get mainPixel => 400;

  @override
  // TODO: implement mainAxisSpacing
  double get mainAxisSpacing => 0;

  @override
  // TODO: implement crossAxisSpacing
  double get crossAxisSpacing => 0;

  @override
  // TODO: implement padding
  EdgeInsetsGeometry get padding => EdgeInsets.zero;

  @override
  Widget itemBuild(BuildContext context, int index, String data) {
    // TODO: implement itemBuild
    return Container();
  }

  @override
  // TODO: implement sliverAppBar
  SliverAppBar get sliverAppBar => SliverAppBar(
        backgroundColor: Colors.white,
        leading: Button(
          onPressed: () {
//            _controller.show
            popWidget();
          },
          child: Icon(
            Icons.arrow_back_ios,
            color: Colors.black,
          ),
        ),
        pinned: true,
        expandedHeight: mainPixel,
        flexibleSpace: AppMapBar(
          background: AmapView(
            mapType: MapType.Standard,
            showZoomControl: false,
            maskDelay: Duration(milliseconds: 500),
            onMapCreated: (controller) async {},
          ),
          collapseMode: CollapseMode.none,
        ),
      );
}

class MmpItem2 extends Item<int> {
  @override
  // TODO: implement crossCount
  int get crossCount => 1;

  @override
  // TODO: implement mainAxisSpacing
  double get mainAxisSpacing => 10;

  @override
  // TODO: implement padding
  EdgeInsetsGeometry get padding => EdgeInsets.only(left: 10, right: 10);

  @override
  Widget itemBuild(BuildContext context, int index, int data) {
    // TODO: implement itemBuild
    return Container(
      height: 100,
      color: Colors.black26,
    );
  }
}

class MmpItem4 extends Item<bool> {
  @override
  // TODO: implement crossCount
  int get crossCount => 1;

  @override
  // TODO: implement mainPixel
  double get mainPixel => 200;

  @override
  // TODO: implement mainAxisSpacing
  double get mainAxisSpacing => 10;

  @override
  // TODO: implement padding
  EdgeInsetsGeometry get padding => EdgeInsets.only(bottom: 10, top: 10);

  @override
  Widget itemBuild(BuildContext context, int index, bool data) {
    return Swiper.list(
      containerHeight: mainPixel,
      list: ["", "", "", ""],
      viewportFraction: 0.8,
      scale: 0.8,
      builder: (c, i, x) {
        return Container(
          child: Image.network(
            "https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=270785989,3805817499&fm=26&gp=0.jpg",
            fit: BoxFit.fill,
          ),
        );
      },
    );
  }
}

class MmpItem3 extends Item<double> {
  @override
  // TODO: implement crossCount
  int get crossCount => 4;

  @override
  // TODO: implement mainPixel
  double get mainPixel => 50;

  @override
  // TODO: implement mainAxisSpacing
  double get mainAxisSpacing => 10;

  @override
  // TODO: implement crossAxisSpacing
  double get crossAxisSpacing => 10;

  @override
  // TODO: implement padding
  EdgeInsetsGeometry get padding => EdgeInsets.symmetric(horizontal: 10);

  @override
  Widget itemBuild(BuildContext context, int index, double data) {
    // TODO: implement itemBuild
    return Container(
      color: Colors.red,
    );
  }
}
